{extend name="home/public/base" /}

<!--尾部-->

<!--返回顶部-->
{block name="content"}
{__block__}
<div class="c-r right">
	<div class="label1">
		<div class="title">
			产品管理
		</div>
		<div class="label-3 label">
			<div class="search">
				<div class="">
					<input type="text" name="" id="" value="" placeholder="产品名称"/><button><i></i><span>搜产品</span></button>
				</div>
			</div>
			<div class="Statistics">
				<button class="delete">批量删除</button>
				<button class="blue"><a href="product-gl-add.html">添加产品</a></button>
				<span class="right">共有数据：<b>11</b>条</span>
				<div class="clear"></div>
			</div>

			<div class="Tab Tabs">
				<table border="0" cellspacing="0" cellpadding="0" style="width: 984px;">
					<tr>
						<th style="width: 40px;"><input type="checkbox" name="" id="" value="" /></th>
						<th style="width: 60px;">ID</th>
						<th style="width: 100px;">缩略图</th>
						<th style="width: 130px;">产品名</th>
						<th style="width: 200px;">描述</th>
						<th style="width: 90px;">单价</th>
						<th style="width: 70px;">排序</th>
						<th style="width: 60px;">发布状态</th>
						<th style="width: 200px;">操作</th>
					</tr>
				</table>
				<table border="0" cellspacing="0" cellpadding="0" style="width: 984px;">
					<tr>
						<td style="width: 40px;"><input type="checkbox" name="" id="" value="" /></td>
						<td style="width: 60px;">1999</td>
						<td style="width: 100px;"><img src="img/goumai.jpg" style="width: 60px;"/></td>
						<td style="width: 130px;" class="align-r">手机</td>
						<td style="width: 200px;" class="align-r">手机手机手机手机手机</td>
						<td style="width: 90px;">999.00</td>
						<td style="width: 70px;"><input type="text" name="" id="" value="" style="width: 50px;" onblur='upajax(55,$(this))'/></td>
						<td style="width: 60px"><span class="green">已上架</span></td>
						<td style="width: 200px;"><button class="modifybtn ml top" onclick="shelves(1,$(this))">上架</button><button class="openbtn ml bottom shelves" onclick="shelves(0,$(this))">下架</button><button class="modifybtn ml open-win">查看</button><button class="modifybtn ml">编辑</button><button class="openbtn" onclick="del(0,$(this))">删除</button></td>
					</tr>
					<tr>
						<td style="width: 40px;"><input type="checkbox" name="" id="" value="" /></td>
						<td style="width: 60px;">1999</td>
						<td style="width: 100px;"><img src="img/goumai.jpg" style="width: 60px;"/></td>
						<td style="width: 130px;" class="align-r">手机</td>
						<td style="width: 200px;" class="align-r">手机手机手机手机手机</td>
						<td style="width: 90px;">999.00</td>
						<td style="width: 70px;"><input type="text" name="" id="" value="" style="width: 50px;" onblur='upajax(55,$(this))'/></td>
						<td style="width: 60px"><span class="green">已上架</span></td>
						<td style="width: 200px;"><button class="modifybtn ml top" onclick="shelves(1,$(this))">上架</button><button class="openbtn ml bottom shelves" onclick="shelves(0,$(this))">下架</button><button class="modifybtn ml open-win">查看</button><button class="modifybtn ml">编辑</button><button class="openbtn" onclick="del(0,$(this))">删除</button></td>
					</tr>
					<tr>
						<td style="width: 40px;"><input type="checkbox" name="" id="" value="" /></td>
						<td style="width: 60px;">1999</td>
						<td style="width: 100px;"><img src="img/goumai.jpg" style="width: 60px;"/></td>
						<td style="width: 130px;" class="align-r">手机</td>
						<td style="width: 200px;" class="align-r">手机手机手机手机手机</td>
						<td style="width: 90px;">999.00</td>
						<td style="width: 70px;"><input type="text" name="" id="" value="" style="width: 50px;" onblur='upajax(55,$(this))'/></td>
						<td style="width: 60px"><span class="green">已上架</span></td>
						<td style="width: 200px;"><button class="modifybtn ml top" onclick="shelves(1,$(this))">上架</button><button class="openbtn ml bottom shelves" onclick="shelves(0,$(this))">下架</button><button class="modifybtn ml open-win">查看</button><button class="modifybtn ml">编辑</button><button class="openbtn" onclick="del(0,$(this))">删除</button></td>
					</tr>
				</table>
			</div>

		</div>
	</div>
</div>
<div id="wrap" class="wrap">
	<div class="wrap-body express">
		<div class="title">
			详情查看
		</div>
		<div class="wrap-con"id="forms">
			<form action="" method="post" class="form-2">
				<div><label>标题:</label><input type="text" name="" id="" value="" style="width: 225px;float: left;"/><label>标题:</label><input type="text" name="" id="" value="" style="width: 225px;;"/><span></span></div>

				<div><label>标题:</label><input type="text" name="" id="" value="" /><span></span></div>
				<div><label>图片:</label><img src="img/goumai.jpg" width="200px"height="180px"/><span></span></div>
				<div><label>标题:</label><textarea name="" rows="" cols=""></textarea><span></span></div>

			</form>
		</div>
		<span class="close-wrap close-win">×</span>
		<div class="wrap-btn">
			<span class="close-btn close-win">取消</span>
			<span class="next-btn close-win">确认</span>
		</div>
	</div>
</div>

<script type="text/javascript">
	function upajax(o,j){
		$.ajax({
			url:"data/add.json",			//请求地址加参数
			success: function(data){
				prompt()
			},
			error:function(){
				alert('更新失败')
			}
		});
	}




	function shelves(val,j){
		var data = [
			{'name':val},
			{'id':j}
		];
		$.ajax({
			type:'post',
			url:"__publicPath__/commtype/templateajax.shtml",			//请求地址加参数
			data: data,
			success: function(data){
				console.log(data[0].name);
				var Parent = j.parent().parent()
				if (val == 0) {
					Parent.find('.green').text('未上架')
					Parent.find('.green').addClass('red')
				} else{
					Parent.find('.green').text('已上架')
					Parent.find('.green').removeClass('red')
				}

			},
			error:function(){
				alert('更新失败')
			}
		});
	}

	function del(val,j){
		if(window.confirm('你确定要删除吗吗？')){
			$.ajax({
				type:"get",
				url:"data/add.json",			//请求地址加参数
				data:'id:'+j,
				success: function(data){
					var Parent = j.parent().parent()
					Parent.remove()
				},
				error:function(){
					alert('更新失败')
				}
			});
		}else{
			//alert("取消");
			return false;
		}
	}
</script>

{/block}

